package com.zelic.zwrite;

public class Vector {
	private double x;
	private double y;
	
	public double getX(){
		return x;
	}
	
	public void setX(double x){
		this.x = x;
	}
	
	public double getY(){
		return y;
	}
	
	public void setY(double y){
		this.y = y;
	}
	
	public Vector(){
		x = 0;
		y = 0;
	}
	
	public Vector(double x, double y){
		this.x = x;
		this.y = y;
	}
	
	
	/**
	 * Create a vector from 2 given points
	 * @param a: src point
	 * @param b: dest point
	 */
	public Vector(Point a, Point b){
		this.x = b.getX() - a.getX();
		this.y = b.getY() - a.getY();
	}
	
	public double Module(){
		return Math.sqrt(x*x+y*y);
	}
	
	public double maxComponent(){
		if (x>y){
			return x;
		}
		return y;
	}
	
}
